package me.zk.practice1.hw;

import java.util.Scanner;

/**
 * @author zhangkai
 * @date 2023/8/10 18:08
 */
public class HWBJJ14 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        while (scanner.hasNext()) {
            int n = scanner.nextInt();

            int m = scanner.nextInt();

            int[] nums = new int[n];

            for (int i = 0; i < n; i++) {
                nums[i] = scanner.nextInt();
            }

            int[] y = new int[m];

            int s = 0;
            boolean isOk = false;
            for (int i = 0; i < n; i++) {
                s= (s + nums[i] )% m;
                if (y[s] != 0) {
                    isOk = true;
                    break;
                }
                y[s] = 1;
            }
            System.out.println(isOk?1:0);
        }
    }
}
